<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.db.conn"%>
<%@ page import="java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <jsp:include flush="true" page="${basePath}/admin/head.jsp"></jsp:include>
    <script src="<%=path %>/admin/js/jquery.js" type="text/javascript"></script>
    <script src="<%=path %>/admin/js/formValidator.js" type="text/javascript"></script>  
    <script src="<%=path %>/admin/js/formValidatorRegex.js" type="text/javascript"></script>
    <link href="<%=path %>/admin/css/validator.css" rel="stylesheet" type="text/css" />
    <style>
        .password-form-container {
            max-width: 800px;
            margin: 2rem auto;
            padding: 0 1rem;
        }
        
        .password-card {
            background: white;
            border-radius: 0.5rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            overflow: hidden;
        }
        
        .password-header {
            background: var(--primary-color);
            color: white;
            padding: 1.5rem;
            border-bottom: 1px solid var(--border-color);
        }
        
        .password-title {
            margin: 0;
            font-size: 1.5rem;
            font-weight: 600;
        }
        
        .password-body {
            padding: 2rem;
        }
        
        .form-group {
            margin-bottom: 1.5rem;
            display: flex;
            align-items: flex-start;
        }
        
        .form-label {
            width: 120px;
            padding-top: 0.75rem;
            font-weight: 500;
            color: var(--text-color);
            text-align: right;
            padding-right: 1rem;
        }
        
        .form-input-group {
            flex: 1;
        }
        
        .form-control {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid var(--border-color);
            border-radius: 0.25rem;
            transition: all 0.3s ease;
            font-size: 1rem;
        }
        
        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
            outline: none;
        }
        
        .form-control::placeholder {
            color: var(--text-muted);
        }
        
        .error-message {
            color: var(--danger-color);
            font-size: 0.875rem;
            margin-top: 0.25rem;
        }
        
        .button-container {
            margin-top: 2rem;
            display: flex;
            justify-content: center;
        }
        
        .btn {
            padding: 0.75rem 2rem;
            border: none;
            border-radius: 0.25rem;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 500;
            font-size: 1rem;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .btn-primary {
            background: var(--primary-color);
            color: white;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        
        .required-mark {
            color: var(--danger-color);
            margin-right: 0.25rem;
        }
        
        @media (max-width: 768px) {
            .password-form-container {
                margin: 1rem auto;
            }
            
            .password-body {
                padding: 1rem;
            }
            
            .form-group {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .form-label {
                width: 100%;
                text-align: left;
                padding-right: 0;
                margin-bottom: 0.5rem;
            }
            
            .btn {
                width: 100%;
                justify-content: center;
            }
        }
    </style>
  </head>

  <body class="ms-body ms-aside-left-open ms-primary-theme ms-has-quickbar">
    <div class="password-form-container">
        <div class="password-card">
            <div class="password-header">
                <h6 class="password-title">修改密码</h6>
            </div>
            <div class="password-body">
                <form action="<%=path %>/admin_Pass" method="post">
                    <div class="form-group">
                        <label class="form-label">
                            <span class="required-mark">*</span>原密码:
                        </label>
                        <div class="form-input-group">
                            <input name="txt_pwd" id="txt_pwd" type="password" class="form-control" placeholder="请输入原密码" />
                            <div id="txt_pwdTip" class="error-message"></div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="form-label">
                            <span class="required-mark">*</span>新密码:
                        </label>
                        <div class="form-input-group">
                            <input name="txt_pwd2" id="txt_pwd2" type="password" class="form-control" placeholder="请输入新密码" />
                            <div id="txt_pwd2Tip" class="error-message"></div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="form-label">
                            <span class="required-mark">*</span>确认密码:
                        </label>
                        <div class="form-input-group">
                            <input name="txt_pwd3" id="txt_pwd3" type="password" class="form-control" placeholder="请再次输入新密码" />
                            <div id="txt_pwd3Tip" class="error-message"></div>
                        </div>
                    </div>

                    <div class="button-container">
                        <button type="submit" name="btnAdd" id="btnAdd" class="btn btn-primary" onclick="return jQuery.formValidator.PageIsValid('1');">
                            <i class="fas fa-save"></i> 确定
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $.formValidator.initConfig({ onError: function (msg) { alert(msg) } });
            $("#txt_pwd").formValidator({ onshow: "请输入原密码", onfocus: "原密码不能为空", oncorrect: "密码合法" }).InputValidator({ min: 1, onerror: "原密码不能为空,请确认" });
            $("#txt_pwd2").formValidator({ onshow: "请输入新密码", onfocus: "新密码不能为空", oncorrect: "密码合法" }).InputValidator({ min: 1, onerror: "新密码不能为空,请确认" });
            $("#txt_pwd3").formValidator({ onshow: "请输入重复密码", onfocus: "两次密码必须一致哦", oncorrect: "密码合法" }).InputValidator({ min: 1, onerror: "重复密码不能为空,请确认" });
        });
    </script>
  </body>
</html> 